package com.freemypay.java.十二通过异常处理错误.九异常的限制;

/**
 * 不懂！看别人代码最烦！！！
 * @author yesixian
 * @date 2018年7月19日
 */
public class StormyInning extends Inning implements Storm {
	public StormyInning() throws RainedOut, BaseballException {}
	
	public StormyInning(String s) throws Foul, BaseballException {}
	
	// Regular methods must conform to base class;
//	public void event() throws RainedOut {}
	
//	void walk() throws PopFoul {}
//	public void rainHard() throws RainedOut {}
	
	@Override
	public void event() {
	}

	public void rainHard() throws RainedOut {
		// TODO Auto-generated method stub
		
	}

	@Override
	public void atBat() throws Strike, Foul {
		// TODO Auto-generated method stub
		
	}
}

class BaseballException extends Exception {}

/**
 * 违反规则的异常
 * @author yesixian
 * @date 2018年7月18日
 */
class Foul extends BaseballException {}

/**
 * 攻击异常
 * @author yesixian
 * @date 2018年7月18日
 */
class Strike extends BaseballException {}

abstract class Inning {
	public Inning() throws BaseballException {
		// TODO Auto-generated constructor stub
	}
	
	public void event() throws BaseballException {
		// Doesn't actually have to throw anything
	}
	
	public abstract void atBat() throws Strike, Foul;
	
	public void walk() {} // Throws no checked exceptions
}

/**
 * 暴雨异常
 * @author yesixian
 * @date 2018年7月18日
 */
class StormException extends Exception {}

class RainedOut extends StormException {}

class PopFoul extends Foul {}

interface Storm {
	public void event() throws RainedOut;
	public void rainHard() throws RainedOut;
}




